﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ProjectManagement.Domain.Services;
using ProjectManagement.Domain.Entities;

namespace ProjectManagement.Web.Controllers
{
    public class MakeController : Controller
    {
        //
        // GET: /Make/

		CityService _cityService = new CityService();

        public ActionResult Index()
        {
			UserService _userService = new UserService();
            return View(_userService.QueryAll());
        }

		public ActionResult GiveRole()
		{
			UserRoleService _userRole = new UserRoleService();
			UserRole u = new UserRole { 
				RoleID=4,
				UserID=1
			};
			return View(u);
		}

		[HttpPost]
		public ActionResult GiveRole(UserRole r)
		{
			return View();
		}



		//测试地市级联弹出框
		public ActionResult AlterPC()
		{
			return View();
		}

		public JsonResult GetSelectedList(string id)
		{
			int sid = int.Parse(id);
			List<Object> list = new List<Object>();
			var cities = _cityService.QueryCityByProId(sid);
			foreach (var item in cities)
			{
				list.Add(new
				{
					ID = item.ID,
					Name = item.Name
				});
			}
			return Json(list, JsonRequestBehavior.AllowGet);
		}

    }
}
